<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="a1">传统方式</button>
    <button class="a2">事件监听</button>
</body>
</html>
<script>
    var a1=document.querySelector('.a1')
    var a2=document.querySelector('.a2')
    a2.addEventListener('click',function(){
        alert('只因你太美！')
    })
    a2.addEventListener('click',function(){
        alert('你看这个面又长又宽！')
    })
</script>